package com.revzone.demo001.entity.PermissionEntity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author lsa
 * @since 2023-04-04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "menu",autoResultMap = true)
public class Menu implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty("菜单主键ID")
    private Long id;

    @TableField("menu_name")
    @ApiModelProperty("菜单")
    private String menuName;

    @TableField("nick_name")
    @ApiModelProperty("别名")
    private String nickName;

    @TableField("parent_id")
    @ApiModelProperty("父子节点")
    private Long parentId;

    @TableField("path")
    @ApiModelProperty("路由地址")
    private String path;

    @TableField("icon")
    @ApiModelProperty("图形")
    private String icon;

    @TableField(value = "button_list",typeHandler = FastjsonTypeHandler.class, jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty("按钮列表")
    private List buttonList;

    @TableField("type")
    @ApiModelProperty("类型")
    private Integer type;

    @TableField("create_by")
    @ApiModelProperty("创建人")
    private Long createBy;

    @TableField("update_by")
    @ApiModelProperty("修改人")
    private Long updateBy;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("创建时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("create_date")
    private Date createDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("修改时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("update_date")
    private Date updateDate;

    @TableField("status")
    @ApiModelProperty("状态")
    private Integer status;

    @TableField("remarks")
    @ApiModelProperty("备注")
    private String remarks;

    @TableField(exist = false)//非数据库字段
    @ApiModelProperty("子节点列表")
    private List<Menu> Children; //

    @TableField(exist = false)//非数据库字段
    @ApiModelProperty("父节点列表")
    private Menu Parent; //

    @TableField(exist = false)//非数据库字段
    @ApiModelProperty("排序")
    private Long sort;

}
